/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1591323820879_1580';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };
  // jwt验证
  config.jwt = {
    secret: "my_token"
  };
  // csrf验证关闭
  config.security = {
    csrf: {
      enable: false,
    }
  }
  // 解决前端跨域问题
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
  };
  // ORM框sequelize 操作MySQL配置信息
  config.sequelize = {
    dialect: 'mysql',
    username: "root",
    // password: "WANGxh123456",
    // host: 'rm-bp1109zg2rshxa113jo.mysql.rds.aliyuncs.com',
    password: "wxh123456.",
    host: '101.42.3.161',
    port: 3306,
    database: 'wxh_development',
    define: { // model的全局配置
      timestamps: false, // 添加create,update,delete时间戳
      // paranoid: true, // 添加软删除
      // freezeTableName: true, // 防止修改表名为复数
      // underscored: false // 防止驼峰式字段被默认转为下划线
    }
  };
  config.alinode = {
    server: 'wss://agentserver.node.aliyun.com:8080',
    appid: '85166',
    secret: '24e8aabedef929413e2598baf3b23d4719ffa2e9',
  }

  return {
    ...config,
    ...userConfig,
  };
};